dnl $Id$
dnl config.m4 for extension nmath

dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.

dnl If your extension references something external, use with:

dnl PHP_ARG_WITH(nmath, for nmath support,
dnl Make sure that the comment is aligned:
dnl [  --with-nmath             Include nmath support])

dnl Otherwise use enable:

PHP_ARG_ENABLE(nmath, whether to enable nmath support,
[  --disable-nmath           Enable nmath support], yes)

if test "$PHP_NMATH" != "no"; then
  dnl # --with-nmath -> check with-path
   SEARCH_PATH="/home/vudao/work/nmath/ext/nmath"     # you might want to change this
   SEARCH_FOR="lib/libfunct.a"  # you most likely want to change this
   #if test -r $PHP_NMATH/$SEARCH_FOR; then # path given as parameter
   #  NMATH_DIR=$PHP_NMATH
   #else # search default path list
   #  AC_MSG_CHECKING([for nmath files in default path])
   #  for i in $SEARCH_PATH ; do
   #    if test -r $i/$SEARCH_FOR; then
   #     NMATH_DIR=$i
   #     AC_MSG_RESULT(found in $i)
   #   fi
   # done
   #fi	
	
	#if test -z "$NMATH_DIR"; then
	#	AC_MSG_RESULT([not found])
	#	AC_MSG_ERROR([Please reinstall the libfunct distribution - *.h should be /include and *.a should be in /lib])
	#fi
  dnl # --with-nmath -> add include path
	PHP_ADD_INCLUDE($NMATH_DIR/include)
	
  #Sources files
  funct_sources = "nmbase.c derivative.c funct.c"

  #dnl # --with-nmath -> check for lib and symbol presence
  #LIBNAME=funct # you may want to change this
  #LIBSYMBOL="acos" # some symbol in the lib that your extension needs, you most likely want to change this 

  #PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
  # [ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NMATH_DIR/lib, NMATH_SHARED_LIBADD) AC_DEFINE(HAVE_NMATHLIB,1,[ ])],
  # [ AC_MSG_ERROR([wrong nmath lib version or lib not found])],
  # [ -L$NMATH_DIR/lib -lfunct -lm -lpthread])
   
  #PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NMATH_DIR/lib, NMATH_SHARED_LIBADD)
  #AC_DEFINE(HAVE_NMATHLIB,1,[ ])
  AC_DEFINE(HAVE_NMATH,1,[Whether you have nmath support])
  PHP_SUBST(NMATH_SHARED_LIBADD)
  PHP_NEW_EXTENSION(nmath, nmbase.c derivative.c funct.c nmath.c, $ext_shared)
fi
